package com.esisa.business;

import com.esisa.dao.CompteDao;
import com.esisa.dao.VeterinaireDao;
import com.esisa.exceptions.UserAlreadyExistsException;
import com.esisa.models.Veterinaire;

public class DefaultVeterinaireManager implements VeterinaireManager {

	private VeterinaireDao veterinaireDao;
	private CompteDao compteDao;
	@Override
	public boolean create(Veterinaire veterinaire) {
			System.out.println(">>>DefaultVeterinaireManager.create();");
		try {
			veterinaireDao.insert(veterinaire);
			compteDao.insert(veterinaire.getCompte());
		} catch (UserAlreadyExistsException e) {
			return false;
		}
		return true;
	}
	public void setVeterinaireDao(VeterinaireDao veterinaireDao) {
		this.veterinaireDao = veterinaireDao;
	}
	public void setCompteDao(CompteDao compteDao) {
		this.compteDao = compteDao;
	}
}
